﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsoleApplication1.segments;

namespace ConsoleApplication1
{
    class hl7
    {
        private string source;
        enum message { ORM, ORU, ADT }

        private ORM orm;
        private ORU oru;
        
       public void recive(string source1)
       {
           msh msh = new msh();
           int i=0;
           while (source1[i].ToString() + source1[i + 1].ToString() + source1[i + 2].ToString() != "MSH")
           {
               
               i++;
           }
           msh.fill(source1, i + 3);
           if (msh.message_type.message_type.ToString() == message.ORM.ToString())
           {
               orm = new ORM(source1);
               orm.fill();
           }
           else if (msh.message_type.message_type.ToString() == message.ORU.ToString())
           {
               oru = new  ORU (source1);
               oru.fill();
           }
       }

       //public void send();
    }
}
